//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_VmConstraintValidator_H
#define Green_VmConstraintValidator_H

#include <vector>

#include "Defines.h"

namespace Green
{
  class VmConstraint;
  class GenPageRequest;
  class AddressFilteringRegulator;
  class VmMapper;
  class ConstraintSet;

  /*!
    \class VmConstraintValidator
    \brief A small class used to validating address against VmConstraint.
  */
  class VmConstraintValidator {
  public:
    VmConstraintValidator(const GenPageRequest* pPageReq, const AddressFilteringRegulator* pAddrRegulator, const VmMapper* pVmMapper); //!< Constructor with necessary parameters.
    ~VmConstraintValidator(); //!< Desctructor.

    bool IsValid(uint64 value) const; //!< Return whether value is valid according to the VmConstraint requirements.
    void ApplyOn(ConstraintSet& rConstr) const; //!< Apply VmConstraint requirements on the passed in rConstr.

    ASSIGNMENT_OPERATOR_ABSENT(VmConstraintValidator);
    DEFAULT_CONSTRUCTOR_ABSENT(VmConstraintValidator);
    COPY_CONSTRUCTOR_ABSENT(VmConstraintValidator);
  private:
    const GenPageRequest* mpPageRequest; //!< Pointer to page request for the virtual address to be validated.
    const AddressFilteringRegulator* mpAddressRegulator; //!< Pointer to address regulator used to validate address.
    const VmMapper* mpVmMapper; //!< Pointer to VmMapper used to validate address.
    std::vector<VmConstraint *> mVmConstraints; //!< Container for the VmConstraint objects.
  };

}

#endif
